Integrand size = 18, antiderivative size = 110 \[ \int \frac {\cos (x) \sin ^2(x)}{(a \cos (x)+b \sin (x))^2} \, dx=-\frac {a \left (a^2-2 b^2\right ) \text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{5/2}}-\frac {2 a b \cos (x)}{\left (a^2+b^2\right )^2}-\frac {\left (a^2-b^2\right ) \sin (x)}{\left (a^2+b^2\right )^2}-\frac {a^2 b}{\left (a^2+b^2\right )^2 (a \cos (x)+b \sin (x))} \]
[Out]
Time = 0.30 (sec) , antiderivative size = 152, normalized size of antiderivative = 1.38, number of steps used = 13, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.444, Rules used = {3190, 3188, 2717, 2718, 3153, 212, 3178, 3233} \[ \int \frac {\cos (x) \sin ^2(x)}{(a \cos (x)+b \sin (x))^2} \, dx=\frac {2 a b^2 \text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{5/2}}-\frac {a^2 \sin (x)}{\left (a^2+b^2\right )^2}+\frac {b^2 \sin (x)}{\left (a^2+b^2\right )^2}-\frac {2 a b \cos (x)}{\left (a^2+b^2\right )^2}-\frac {a^2 b}{\left (a^2+b^2\right )^2 (a \cos (x)+b \sin (x))}-\frac {a^3 \text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{5/2}} \]
[In]
[Out]
Rule 212
Rule 2717
Rule 2718
Rule 3153
Rule 3178
Rule 3188
Rule 3190
Rule 3233
Rubi steps \begin{align*} \text {integral}& = \frac {a \int \frac {\sin ^2(x)}{a \cos (x)+b \sin (x)} \, dx}{a^2+b^2}+\frac {b \int \frac {\cos (x) \sin (x)}{a \cos (x)+b \sin (x)} \, dx}{a^2+b^2}-\frac {(a b) \int \frac {\sin (x)}{(a \cos (x)+b \sin (x))^2} \, dx}{a^2+b^2} \\ & = -\frac {a^2 \sin (x)}{\left (a^2+b^2\right )^2}-\frac {a^2 b}{\left (a^2+b^2\right )^2 (a \cos (x)+b \sin (x))}+\frac {a^3 \int \frac {1}{a \cos (x)+b \sin (x)} \, dx}{\left (a^2+b^2\right )^2}+2 \frac {(a b) \int \sin (x) \, dx}{\left (a^2+b^2\right )^2}+\frac {b^2 \int \cos (x) \, dx}{\left (a^2+b^2\right )^2}-2 \frac {\left (a b^2\right ) \int \frac {1}{a \cos (x)+b \sin (x)} \, dx}{\left (a^2+b^2\right )^2} \\ & = -\frac {2 a b \cos (x)}{\left (a^2+b^2\right )^2}-\frac {a^2 \sin (x)}{\left (a^2+b^2\right )^2}+\frac {b^2 \sin (x)}{\left (a^2+b^2\right )^2}-\frac {a^2 b}{\left (a^2+b^2\right )^2 (a \cos (x)+b \sin (x))}-\frac {a^3 \text {Subst}\left (\int \frac {1}{a^2+b^2-x^2} \, dx,x,b \cos (x)-a \sin (x)\right )}{\left (a^2+b^2\right )^2}+2 \frac {\left (a b^2\right ) \text {Subst}\left (\int \frac {1}{a^2+b^2-x^2} \, dx,x,b \cos (x)-a \sin (x)\right )}{\left (a^2+b^2\right )^2} \\ & = -\frac {a^3 \text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{5/2}}+\frac {2 a b^2 \text {arctanh}\left (\frac {b \cos (x)-a \sin (x)}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{5/2}}-\frac {2 a b \cos (x)}{\left (a^2+b^2\right )^2}-\frac {a^2 \sin (x)}{\left (a^2+b^2\right )^2}+\frac {b^2 \sin (x)}{\left (a^2+b^2\right )^2}-\frac {a^2 b}{\left (a^2+b^2\right )^2 (a \cos (x)+b \sin (x))} \\ \end{align*}
Time = 0.81 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.01 \[ \int \frac {\cos (x) \sin ^2(x)}{(a \cos (x)+b \sin (x))^2} \, dx=\frac {2 a \left (a^2-2 b^2\right ) \text {arctanh}\left (\frac {-b+a \tan \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{\left (a^2+b^2\right )^{5/2}}-\frac {5 a^2 b-b^3+b \left (a^2+b^2\right ) \cos (2 x)+a \left (a^2+b^2\right ) \sin (2 x)}{2 \left (a^2+b^2\right )^2 (a \cos (x)+b \sin (x))} \]
[In]
[Out]
Time = 0.64 (sec) , antiderivative size = 142, normalized size of antiderivative = 1.29
method | result | size |
default | \(-\frac {2 a \left (\frac {-b^{2} \tan \left (\frac {x}{2}\right )-a b}{\tan \left (\frac {x}{2}\right )^{2} a -2 b \tan \left (\frac {x}{2}\right )-a}-\frac {\left (a^{2}-2 b^{2}\right ) \operatorname {arctanh}\left (\frac {2 a \tan \left (\frac {x}{2}\right )-2 b}{2 \sqrt {a^{2}+b^{2}}}\right )}{\sqrt {a^{2}+b^{2}}}\right )}{\left (a^{2}+b^{2}\right )^{2}}+\frac {2 \left (-a^{2}+b^{2}\right ) \tan \left (\frac {x}{2}\right )-4 a b}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (1+\tan \left (\frac {x}{2}\right )^{2}\right )}\) | \(142\) |
risch | \(\frac {i {\mathrm e}^{i x}}{-4 i b a +2 a^{2}-2 b^{2}}-\frac {i {\mathrm e}^{-i x}}{2 \left (2 i b a +a^{2}-b^{2}\right )}-\frac {2 b \,a^{2} {\mathrm e}^{i x}}{\left (i b +a \right )^{2} \left (-i b +a \right )^{2} \left (-i b \,{\mathrm e}^{2 i x}+a \,{\mathrm e}^{2 i x}+i b +a \right )}-\frac {a^{3} \ln \left ({\mathrm e}^{i x}-\frac {i a^{5}+2 i a^{3} b^{2}+i a \,b^{4}-a^{4} b -2 a^{2} b^{3}-b^{5}}{\left (a^{2}+b^{2}\right )^{\frac {5}{2}}}\right )}{\left (a^{2}+b^{2}\right )^{\frac {5}{2}}}+\frac {2 a \ln \left ({\mathrm e}^{i x}-\frac {i a^{5}+2 i a^{3} b^{2}+i a \,b^{4}-a^{4} b -2 a^{2} b^{3}-b^{5}}{\left (a^{2}+b^{2}\right )^{\frac {5}{2}}}\right ) b^{2}}{\left (a^{2}+b^{2}\right )^{\frac {5}{2}}}+\frac {a^{3} \ln \left ({\mathrm e}^{i x}+\frac {i a^{5}+2 i a^{3} b^{2}+i a \,b^{4}-a^{4} b -2 a^{2} b^{3}-b^{5}}{\left (a^{2}+b^{2}\right )^{\frac {5}{2}}}\right )}{\left (a^{2}+b^{2}\right )^{\frac {5}{2}}}-\frac {2 a \ln \left ({\mathrm e}^{i x}+\frac {i a^{5}+2 i a^{3} b^{2}+i a \,b^{4}-a^{4} b -2 a^{2} b^{3}-b^{5}}{\left (a^{2}+b^{2}\right )^{\frac {5}{2}}}\right ) b^{2}}{\left (a^{2}+b^{2}\right )^{\frac {5}{2}}}\) | \(396\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 252 vs. \(2 (106) = 212\).
Time = 0.26 (sec) , antiderivative size = 252, normalized size of antiderivative = 2.29 \[ \int \frac {\cos (x) \sin ^2(x)}{(a \cos (x)+b \sin (x))^2} \, dx=-\frac {4 \, a^{4} b + 2 \, a^{2} b^{3} - 2 \, b^{5} + 2 \, {\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} \cos \left (x\right )^{2} + 2 \, {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} \cos \left (x\right ) \sin \left (x\right ) + \sqrt {a^{2} + b^{2}} {\left ({\left (a^{4} - 2 \, a^{2} b^{2}\right )} \cos \left (x\right ) + {\left (a^{3} b - 2 \, a b^{3}\right )} \sin \left (x\right )\right )} \log \left (\frac {2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} - 2 \, a^{2} - b^{2} - 2 \, \sqrt {a^{2} + b^{2}} {\left (b \cos \left (x\right ) - a \sin \left (x\right )\right )}}{2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + b^{2}}\right )}{2 \, {\left ({\left (a^{7} + 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} + a b^{6}\right )} \cos \left (x\right ) + {\left (a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}\right )} \sin \left (x\right )\right )}} \]
[In]
[Out]
Timed out. \[ \int \frac {\cos (x) \sin ^2(x)}{(a \cos (x)+b \sin (x))^2} \, dx=\text {Timed out} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 265 vs. \(2 (106) = 212\).
Time = 0.30 (sec) , antiderivative size = 265, normalized size of antiderivative = 2.41 \[ \int \frac {\cos (x) \sin ^2(x)}{(a \cos (x)+b \sin (x))^2} \, dx=-\frac {{\left (a^{2} - 2 \, b^{2}\right )} a \log \left (\frac {b - \frac {a \sin \left (x\right )}{\cos \left (x\right ) + 1} + \sqrt {a^{2} + b^{2}}}{b - \frac {a \sin \left (x\right )}{\cos \left (x\right ) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} \sqrt {a^{2} + b^{2}}} - \frac {2 \, {\left (3 \, a^{2} b + \frac {{\left (a^{3} + 4 \, a b^{2}\right )} \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {{\left (a^{2} b - 2 \, b^{3}\right )} \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} - \frac {{\left (a^{3} - 2 \, a b^{2}\right )} \sin \left (x\right )^{3}}{{\left (\cos \left (x\right ) + 1\right )}^{3}}\right )}}{a^{5} + 2 \, a^{3} b^{2} + a b^{4} + \frac {2 \, {\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {2 \, {\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} \sin \left (x\right )^{3}}{{\left (\cos \left (x\right ) + 1\right )}^{3}} - \frac {{\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} \sin \left (x\right )^{4}}{{\left (\cos \left (x\right ) + 1\right )}^{4}}} \]
[In]
[Out]
none
Time = 0.33 (sec) , antiderivative size = 209, normalized size of antiderivative = 1.90 \[ \int \frac {\cos (x) \sin ^2(x)}{(a \cos (x)+b \sin (x))^2} \, dx=-\frac {{\left (a^{3} - 2 \, a b^{2}\right )} \log \left (\frac {{\left | 2 \, a \tan \left (\frac {1}{2} \, x\right ) - 2 \, b - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, a \tan \left (\frac {1}{2} \, x\right ) - 2 \, b + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{{\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} \sqrt {a^{2} + b^{2}}} - \frac {2 \, {\left (a^{3} \tan \left (\frac {1}{2} \, x\right )^{3} - 2 \, a b^{2} \tan \left (\frac {1}{2} \, x\right )^{3} - a^{2} b \tan \left (\frac {1}{2} \, x\right )^{2} + 2 \, b^{3} \tan \left (\frac {1}{2} \, x\right )^{2} - a^{3} \tan \left (\frac {1}{2} \, x\right ) - 4 \, a b^{2} \tan \left (\frac {1}{2} \, x\right ) - 3 \, a^{2} b\right )}}{{\left (a \tan \left (\frac {1}{2} \, x\right )^{4} - 2 \, b \tan \left (\frac {1}{2} \, x\right )^{3} - 2 \, b \tan \left (\frac {1}{2} \, x\right ) - a\right )} {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )}} \]
[In]
[Out]
Time = 23.44 (sec) , antiderivative size = 249, normalized size of antiderivative = 2.26 \[ \int \frac {\cos (x) \sin ^2(x)}{(a \cos (x)+b \sin (x))^2} \, dx=-\frac {\frac {2\,\mathrm {tan}\left (\frac {x}{2}\right )\,\left (a^3+4\,a\,b^2\right )}{a^4+2\,a^2\,b^2+b^4}+\frac {6\,a^2\,b}{a^4+2\,a^2\,b^2+b^4}-\frac {2\,a\,{\mathrm {tan}\left (\frac {x}{2}\right )}^3\,\left (a^2-2\,b^2\right )}{a^4+2\,a^2\,b^2+b^4}+\frac {2\,b\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2\,\left (a^2-2\,b^2\right )}{a^4+2\,a^2\,b^2+b^4}}{-a\,{\mathrm {tan}\left (\frac {x}{2}\right )}^4+2\,b\,{\mathrm {tan}\left (\frac {x}{2}\right )}^3+2\,b\,\mathrm {tan}\left (\frac {x}{2}\right )+a}-\frac {a\,\mathrm {atan}\left (\frac {1{}\mathrm {i}\,\mathrm {tan}\left (\frac {x}{2}\right )\,a^5-a^4\,b\,1{}\mathrm {i}+2{}\mathrm {i}\,\mathrm {tan}\left (\frac {x}{2}\right )\,a^3\,b^2-a^2\,b^3\,2{}\mathrm {i}+1{}\mathrm {i}\,\mathrm {tan}\left (\frac {x}{2}\right )\,a\,b^4-b^5\,1{}\mathrm {i}}{{\left (a^2+b^2\right )}^{5/2}}\right )\,\left (a^2-2\,b^2\right )\,2{}\mathrm {i}}{{\left (a^2+b^2\right )}^{5/2}} \]
[In]
[Out]